package com.aids_malaria.db.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import com.aids_malaria.http.response.GetMedicalTreatmentPack;

import java.util.List;

@Dao
public interface GetMedicalTreatmentPackDao {
    @Query("delete from getMedicalTreatmentPack")
    int deleteAll();

    @Delete
    int delete(GetMedicalTreatmentPack getMedicalTreatmentPack);

    @Query("SELECT * FROM getMedicalTreatmentPack")
    List<GetMedicalTreatmentPack> getAll();

    @Query("SELECT * FROM getMedicalTreatmentPack WHERE createOrUpdate =:isCreateUpdate")
    List<GetMedicalTreatmentPack> getAllByCreateUpdate(boolean isCreateUpdate);

    @Query("SELECT * FROM getMedicalTreatmentPack WHERE identity_code IN (:identity_code)")
    List<GetMedicalTreatmentPack> findById(String identity_code);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Long insert(GetMedicalTreatmentPack user);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    List<Long> insertAll(List<GetMedicalTreatmentPack> users);

    @Update()
    int update(GetMedicalTreatmentPack user);
}
